<template>
  <div class="header">
    <div class="header-left">
      <div class="iconfont back-icon">&#xe658;</div>
    </div>
    <div class="header-input"><span class="iconfont seo">&#xe63c;</span><input class="inp" placeholder="输入城市/景点/游玩主题"></div>
    <router-link to='/city'>
      <div class="header-right">{{this.city}} <!--城市 -->
        <span class="iconfont arrow-icon">&#xe65c;</span>
      </div>
    </router-link>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default{
  name: 'HomeHeader',
  computed: {
    ...mapState(['city']), // 映射数据项
  }
}
</script>

<style lang="stylus" scoped>
  @import '~styles/varibles.styl'
  .header                 //styles 改用别名 表示路径src/assets/styles
    display: flex
    background: $bgColor  //用变量来储存背景的颜色 变量储存到varibles.styl文件下
    line-height $headerHeight
    color #fff
    .header-left
      width: .64rem
      float: left
      .back-icon
        text-align center
        font-size .6rem
    .header-input
      flex: 1
      background #fff
      border-radius .1rem
      margin-top .12rem
      height .64rem
      line-height .64rem
      margin-left .2rem
      color #ccc
      padding-left .2rem
      .seo
        margin-right .1rem
        .inp
          margin-bottom .1rem
          font-size .3rem
    .header-right
      min-width 1.04rem
      padding 0 .1rem
      float: right
      text-align center
      color #fff
      .arrow-icon
        margin-left .1rem
        font-size .32rem
</style>
